<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // 定义初始状态pedding，和初始值undefined，resolve，reject
        function MyPromise(fn){
            this.PromiseState=`pendding`
            this.PromiseResult=undefined
            let resolve =(value)=>{}
            let reject =(errValue)=>{}
            if(fn){
                fn(resolve, reject)
            }
        }
        // .then
        let p =new MyPromise((resolve,reject)=>{
            resolve(`resolve`)
        })
        p.then((res)=>{
            console.log(res)
            console.log(`then`)
        })
        // 不会了
    </script>
</body>
</html>